Avorion Script API Documentation
Sector [Client]
This object is only available on the client.
function Sector()
Returns
A new instance of Sector
property string name |
property Seed seed | [read-only] |
function var addInertiaFieldGlow(var id)
Returns
nothing
function var addStaticHyperspaceGlow(var id)
Returns
nothing
function int callbacksRegistered(string callbackName, var functionName)
Check how many functions are registered to a callback from the current script VM.
Parameters
functionName The name of the function for which to check. If nil, will count all functions that are registered to this callback.
Returns
The amount of functions registered to the callback
function var createDust(vec3 pos, float size, Color color, float lifeSpan)
Returns
nothing
function var createDustExplosion(vec3 pos, float size, Color color)
Returns
nothing
function var createExplosion(vec3 pos, float size, bool silent)
Returns
nothing
function var createGlow(vec3 pos, float size, Color color)
Returns
nothing
function GlowFX createGlowBox(Box box)
function var createGlows(vec3... positions, float size, Color color)
Returns
nothing
function GlowFX createGlowSphere(float radius, ivec2 resolution)
function var createHyperspaceEnteringGlowAnimation(Entity entity)
Returns
nothing
function var createHyperspaceJumpAnimation(Entity entity, vec3 [or nil] direction, Color [or nil] color, var intensity)
Returns
nothing
function LaserFX createLaser(vec3 from, vec3 to, Color color, float width)
function RefractionFX createRefractionBox(Box box)
function RefractionFX createRefractionSphere(float radius, ivec2 resolution)
function var createShockwave(vec3 pos, float size, float duration, vec3 color)
Returns
nothing
function var createSpark(vec3 pos, vec3 v, float size, float aliveTime, Color color, float slowDownFactor, Entity [or nil] entity, var texture)
Returns
nothing
function Entity... getAllies(int factionIndex)
Returns all allies of the given faction in the sector. Allies include ships of the same faction. Allied entities are determined as follows:
- they belong to the same faction
- they belong to factions whose relations are above 70.000
- they belong to players of the same group
- they belong to players of the same alliance
- they belong to a player and their alliance
Parameters
Returns
Multiple values: All detected allies in the sector
function int, int getCoordinates()
function Entity... getEnemies(int factionIndex)
Returns all enemies of the given faction in the sector. Enemies are determined as ships of factions where relations are below -40.000
Parameters
Returns
Multiple return values: All detected enemies in the sector
function Entity... getEntities()
function Entity... getEntitiesByComponent(int component)
function Entity... getEntitiesByComponents(Type... types)
Returns all entities in the sector that have a specific set of components
Parameters
Returns
Multiple return values: All matching entities in the sector
function Entity... getEntitiesByFaction(int factionIndex)
function Entity... getEntitiesByLocation(Sphere sphere)
function Entity... getEntitiesByScript(string scriptName)
function Entity... getEntitiesByScriptValue(string name, var value)
Returns all entities in the sector that have a specific value assigned to them. Values can be set with Entity:setValue(name, value) and read with Entity:getValue(name).
Parameters
value A value to check against. If this is set, only entities will be returned whose value is equal to the passed value. If this is nil, all entities will be returned that have any value with the given name assigned.
Returns
Multiple return values: All matching entities in the sector
function Entity... getEntitiesByType(int type)
function Entity getEntity(var id)
function Entity getEntityByFactionAndName(int factionIndex, string name)
function unsigned int getNumAllies(int faction)
function unsigned int getNumEnemies(int factionIndex)
function unsigned int getNumEntities()
function unsigned int getNumEntitiesByComponent(int component)
function unsigned int getNumEntitiesByComponents()
function unsigned int getNumEntitiesByFaction(int factionIndex)
function unsigned int getNumEntitiesByLocation(Sphere sphere)
function unsigned int getNumEntitiesByScript(string scriptName)
function unsigned int getNumEntitiesByType(int type)
function int... getPresentFactions()
Returns all indices of all present factions
Returns
a list of int indices of all present factions
function var getValue(string name)
function UserObject... intersectBeamRay(Ray ray, Uuid [or nil] ignoredEntity, Uuid [or nil] ignoredEntityShields)
Intersects a beam in the sector, similar to the way that weapon beams are intersected. If an entity has a shield, that shield will be part of the test. If the beam would intersect with multiple entities, then the entity with its intersection point closest to the ray origin is chosen.
Parameters
ignoredEntity A uuid that can be optionally set. If this was set, the entity with this ID will be ignored during the intersection.
ignoredEntityShields A uuid that can be optionally set. If this was set, the shields of the entity with this ID will be ignored during the intersection.
Returns
The entity closest to the origin of the ray, that was hit (if one or more were hit), as well as the point where the ray intersects with the object (or its shield).
function var... invokeFunction(var scriptName, string functionName, var... arguments)
Invokes a function in a script of the sector. Use this function to invoke functions from one script in another script. The first return value of the function is an integer indicating whether or not the call was successful. When it was, this integer is followed by the return values of the invoked function.
Parameters
functionName The name of the function that will be executed
arguments An arbitrary list of arguments that will be given to the invoked function
Returns
Returns at least 1 value indicating if the call succeeded:
0 The call was successful. In this case, the return values of the script are returned in addition to the call result, following the call result.
3 The call failed because the given script was not found
4 The call failed because the given function was not found in the script
5 The call failed because the script's state has errors and is invalid
function int registerCallback(string callbackName, string functionName)
Register a callback in the sector. The callback receiver has to be inside the sector for the registration to succeed. The callback will be removed if the receiver leaves the sector or gets destroyed, or when a hyperspace jump happens. Double registration of callbacks doesn't work. When the same callback to the same callback of the same script instance is registered twice, it will still only be called once.
Parameters
functionName The name of the function that will be executed in the script when the callback happens
Returns
0 on success, 1 if the registration failed
function var removeGlowObject(GlowFX object)
Returns
nothing
function var removeInertiaFieldGlow(var id)
Returns
nothing
function var removeLaser(LaserFX laser)
Returns
nothing
function var removeRefractionObject(RefractionFX object)
Returns
nothing
function var removeStaticHyperspaceGlow(var id)
Returns
nothing
function var resetFog()
Returns
nothing
function var sendCallback()
Returns
nothing
function var setFogColor(Color color)
Returns
nothing
function var setFogColorFactor(float in)
Returns
nothing
function var setFogDensity(float in)
Returns
nothing
function var unregisterCallback(string callbackName, string functionName)
Returns
nothing
Callbacks Alliance [Client] Callbacks Alliance [Server] Callbacks Alliance [Server] Callbacks Entity Callbacks Galaxy Callbacks Player Callbacks Player [Client] Callbacks Sector Callbacks Server Callbacks
Command Entity FactionDatabase PlanGenerator Player Sector Server UsableInventoryItem
Boarding BspTree CargoBay CargoLoot ControlUnit CrewComponent DeletionTimer DirectFlightPhysics DockingClamps DockingParent DockingPositions Durability EnergySystem Engine FighterAI Hangar HyperspaceEngine InteractionText InventoryItemLoot Owner Physics Plan ReadOnlyBoarding ReadOnlyBspTree ReadOnlyCargoBay ReadOnlyControlUnit ReadOnlyCrew ReadOnlyDeletionTimer ReadOnlyEnergySystem ReadOnlyEngine ReadOnlyFighterAI ReadOnlyHangar ReadOnlyHyperspaceEngine ReadOnlyInteractionText ReadOnlyOwner ReadOnlyPhysics ReadOnlyPlan ReadOnlyShipAI ReadOnlyShipSystem ReadOnlyTorpedoAI [Server] [Client] [Server] [Client] ReadOnlyTorpedoAI [Server] [Client] [Server] [Client] ReadOnlyTorpedoLauncher ReadOnlyTurretBases ReadOnlyVelocity ReadOnlyWeapons ReadOnlyWormHole Shield ShipAI ShipSystem StructuralIntegrity SystemUpgradeLoot Thrusters Torpedo TorpedoAI TorpedoLauncher Turret TurretAI TurretBases Velocity Weapons WormHole
AllianceMember AllianceRank BlockPlan BlockPlanBlock BlockStatistics Box Captain Color ControlUnitSeat CraftDesign CraftStatsOverview Crew CrewMan CrewProfession DebugInfo dvec2 dvec3 dvec4 Entity EntityDescriptor FighterTemplate Format GameSettings Group HighResolutionTimer Inventory InventoryTurret ivec2 ivec3 ivec4 Language Mail Material Matrix ModManager NamedFormat PlanBspTree PlanetSpecifics PlanGenerationStage PlanPart PlanStyle PlayerId PluralForm Profiler QuadTree Random Rarity Ray ReadOnlyEntity Rect Relation Scenario SectorView Seed Sphere Squad SystemUpgradeTemplate Timer Tooltip TooltipLine TorpedoShaft TorpedoTemplate TradingGood TurretDesign TurretDesignPart TurretTemplate UsableInventoryItem Uuid VanillaInventoryItem vec2 vec3 vec4 Version Weapon
EntityIcon EntityTooltip PlanMesh ReadOnlyIcon ReadOnlyPlanMesh ReadOnlyScriptUI ReadOnlyTooltip ScriptUI
Achievements Alliance [Client] CameraKeyFrame CaptainSelectionItem Client ClientSettings ColorSelectionItem CraftDesignSelectionItem Faction [Client] Galaxy [Client] GalaxyMap GameInput GlowFX IconSelectionItem InputWindow InventoryReferenceSelectionItem InventorySelectionItem Keyboard LaserFX Mouse Music PixelIconSelectionItem Planet Player [Client] PlayerWindow RefractionFX Sector [Client] SelectionItem ShipDatabaseEntry [Client] SoundSource StrategyState TargetIndicator TooltipRenderer TurretDesignSelectionItem
AllianceEmblem AllianceTab ArrowLine Button [Client] [Client] Button [Client] [Client] CaptainIcon CaptainProfile CheckBox ComboBox ContextMenu CraftPortrait CrewBar Frame Hud InventorySelection Label Line ListBox ListBoxEx MapArrowLine MapIcon MultiLineTextBox NumbersBar Picture PlanDisplayer ProgressBar SavedDesignsSelection ScrollFrame Selection ShipWindow Slider StatisticsBar Tab TabbedWindow TextBox TextField TooltipDisplayer Tree UIArbitraryHorizontalSplitter UIArbitraryVerticalSplitter UIContainer UIElement UIGridSplitter UIHorizontalLister UIHorizontalMultiSplitter UIHorizontalSplitter UIOrganizer UIRect UIRenderer UIVerticalLister UIVerticalMultiSplitter UIVerticalSplitter ValueComboBox Window
EntityTransferrer FighterController Loot ReadOnlyEntityTransferrer ReadOnlyFighterController ReadOnlyLoot ReadOnlyTurretController ReadOnlyWreckageCreator TurretController WreckageCreator
Alliance [Server] Faction [Server] Galaxy [Server] Player [Server] ReadOnlySector Sector [Server] Server ShipDatabaseEntry [Server]
AIState AlliancePrivilege BeamShape BlockShading BlockStructure BlockType BlockType2 BoxType BuildError CaptainGenderId ChatChannel ChatMessageType ComponentType ControlAction ControlActionBit ControlStyle CoolingType CraftStatsOverviewStat CrewProfessionType CrewRank DamageSource DamageType DeletionType Difficulty EntityArrivalType EntityType FighterOrders FighterStartError FighterType FontType ImpactParticles InventoryItemType JumpError KeyboardKey ListBoxEntryType MalusReason MaterialType MoonType MouseButton PlanetType PlayerStateType ProjectileShape RarityType RelationStatus SavedDesignType ScenarioType SectorChangeType ShipAvailability SoundType StatsBonuses TargetIndicatorVisuals TransformationFeature TurretAutoFireMode TurretSlotType WeaponAppearance WeaponCategory
This is the official documentation for the scripting API of Avorion. This documentation is automatically generated and not necessarily complete. Depending on the context in which functions exist, some documentation such as descriptions, return values or variable names or types may be missing.
Work in Progress. Documentation of Avorion Version: 2.5.7 c8e4beec84f7